package com.briup.dao;

import com.briup.bean.Teacher;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
@Repository// dao层的对象 spring自动创建
public class TeacherDAOImpl implements ITeacherDAO{
    @Override
    public Teacher findTeacherById(Integer id) throws Exception {
        //jdbc 连接数据库 ，查询数据 执行sql 返回结果集 封装成对象
        if(id==2){
            throw  new SQLException("数据库异常");
        }
        return new Teacher(id,"tom");
    }
}
